from django.views import View

from SaaSDevelTool.data_mysql_data import db
# 判断梯队位置
from SaaSDevelTool.data_operation import is_number
# 导入返回响应
from SaaSDevelTool.data_return_response import create_response
# 导入错误信息装饰器
from SaaSDevelTool.data_return_response import error_message_detection

"""总页面修改"""


class SaaSDataSumResourceDelete(View):
    @error_message_detection
    def post(self, request):
        # 获取页面编号
        resource_id = request.POST.get("resource_id")
        # 执行删除操作
        delete_sum_page_resource_table_sql = """
            DELETE FROM 
                db_saas_center.sum_page_resource_table
            WHERE
                resource_id = {}
            ;""".format(resource_id)
        # 执行操作
        db.update(delete_sum_page_resource_table_sql)
        # 返回响应
        return create_response(code=200, msg="页面删除成功。")
